import React , {useCallback, useState} from 'react'
// 父组件发生改变子组件重新渲染了
// useCallback
function Bookshelfson(props) {
 let [sum,setSum]  =useState(0)
 // 如果做组件性能优化用useCallback或者useMemo包裹函数即可
let fn =  useCallback(()=>{
     console.log("render");
      setSum(sum+=1)
 },[])
 
  return (

    <div>
        <h4>{sum}</h4>
        bookshelfson
        <button onClick={fn}>点击</button>


    </div>
  )
}

export default Bookshelfson